<template>
  <div class="todoapp">
      <header class="header">
          <h1>todos</h1>
          <input class="new-todo" placeholder="What needs to be down?" 
          v-model="newTodo" @keyup.enter.prevent="handleNewTodoKeyDown"/>
      </header>
      {{count}}
      <!-- <todo-list /> -->
  </div>
</template>
<script>
import Constant from "../constants";
//import TodoList from "./TodoList.vue";

export default {
  name: "Main",
  components: {
    //TodoList
  },
  data() {
    return {
      newTodo: ""
    };
  },
  methods: {
    handleNewTodoKeyDown() {
      Constant.Event.$emit(Constant.ADD_TODO, this.newTodo);
      this.newTodo = "";
    }
  },
  computed: {
    count() {
      return this.$store.state.count;
    }
  }
};
</script>
<style lang="scss" scoped>
.todoapp {
  background: #fff;
  margin: 130px 0 40px 0;
  position: relative;
  box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.2), 0 25px 50px 0 rgba(0, 0, 0, 0.1);
}

.todoapp h1 {
  position: absolute;
  top: -155px;
  width: 100%;
  font-size: 100px;
  font-weight: 100;
  text-align: center;
  color: rgba(175, 47, 47, 0.15);
  text-rendering: optimizeLegibility;
}

.todoapp input::-webkit-input-placeholder {
  font-style: italic;
  font-weight: 300;
  color: #e6e6e6;
}

.todoapp input::-moz-placeholder {
  font-style: italic;
  font-weight: 300;
  color: #e6e6e6;
}

.todoapp input::input-placeholder {
  font-style: italic;
  font-weight: 300;
  color: #e6e6e6;
}

.new-todo,
.edit {
  position: relative;
  margin: 0;
  width: 100%;
  font-size: 24px;
  font-family: inherit;
  font-weight: inherit;
  line-height: 1.4em;
  border: 0;
  outline: none;
  color: inherit;
  padding: 6px;
  border: 1px solid #999;
  box-shadow: inset 0 -1px 5px 0 rgba(0, 0, 0, 0.2);
  box-sizing: border-box;
}

.new-todo {
  padding: 16px 16px 16px 60px;
  border: none;
  background: rgba(0, 0, 0, 0.003);
  box-shadow: inset 0 -2px 1px rgba(0, 0, 0, 0.03);
}
</style>

